﻿using AiShow.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AiShow.WebSite
{
    /// <summary>
    /// 评论页
    /// </summary>
    public partial class Discuss : Page
    {
        protected string VideoId;
        protected string NickName;
        protected string Avatar;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                VideoId = Request.QueryString["id"];
                TBUsers user = IdentityManager.ReadUser();
                if (user == null)
                {
                    //Response.Redirect("~/login.aspx?ReturnURL=Discuss.aspx");//获取当前地址
                    Response.Redirect("~/login.aspx?ReturnURL=" + Request.Url);//可以获取当前页面地址和视频id
                }
                else if (string.IsNullOrWhiteSpace(VideoId))//查询是否存在id
                {
                    Response.Redirect("~/Default.aspx");
                }
                //NickName = user.NickName;
                //Avatar = user.Avatar;
                this.NickName = user.NickName ?? $"用户{user.Id}";
                this.Avatar = user.Avatar ?? "/imgs/avatar.jpg";
            }
        }
    }
}